<template>
  <div class="w-[1150px] relative bg-white h-full print-style">
    <div class="flex justify-between w-full text-center items-center pl-60">
      <div class="flex-1 text-center text-[32px]">{{ getSystemConfig('HISNAME') }}</div>
      <BaseBarcode :value="printData?.printData?.detail[0].key" class="w-60 pr-20 mt-5" />
    </div>
    <div class="flex items-center">
      <div class="w-2/5">{{ printData.printData?.detail[0]?.auditStatus }}</div>
      <div class="text-[22px] font-bold flex-1" style="padding-left: 58px">检验报告单</div>
    </div>
    <div class="w-full mt-8 text-[18px]">
      <div class="flex justify-between pr-32">
        <div>
          <div class="mb-2">
            姓名：{{ printData.printData?.detail[0]?.brName }}<span>{{ printData.printData?.detail[0]?.brXb }}</span
            ><span>{{ printData.printData?.detail[0]?.brAge }}</span>
          </div>
          <div class="mb-2">病人类型：{{ printData.printData?.detail[0]?.recordType }}</div>
          <div class="mb-2">科室：{{ printData.printData?.detail[0]?.applyDeptName }}</div>
        </div>
        <div>
          <div class="mb-2">信息卡号：{{ printData.printData?.detail[0]?.brId }}</div>
          <div class="mb-2">病区\床号：{{ printData.printData?.detail[0]?.bqcw }}</div>
          <div class="mb-2">临床诊断:{{ printData.printData?.detail[0]?.zd }}</div>
        </div>
        <div>
          <div class="mb-2">病历号：{{ printData.printData?.detail[0]?.brBlkh }}</div>
          <div class="mb-2">住院号\门诊号：{{ printData.printData?.detail[0]?.key }}</div>
          <div class="mb-2">备注:{{ printData.printData?.detail[0]?.memo }}</div>
        </div>
        <div>
          <div class="mb-2">仪器：{{ printData.printData?.detail[0]?.instrumentId }}</div>
          <div class="mb-2">样本号：{{ printData.printData?.detail[0]?.recordCode }}</div>
          <div class="mb-2">样本类型:{{ printData.printData?.detail[0]?.recordType }}</div>
        </div>
      </div>
      <div class="flex">
        <div class="w-1/2 pr-5">
          <div class="border border-solid h-[30px] border-x-0 mt-2 flex items-center justify-between">
            <div class="w-2/5">No. 项目名称</div>
            <div class="w-1/5 text-center">结果</div>
            <div class="w-1/5 text-center">参考值</div>
            <div class="w-1/5 text-right">单位</div>
          </div>
        </div>
        <div class="w-1/2 pr-5">
          <div class="border border-solid h-[30px] border-x-0 mt-2 flex items-center justify-between">
            <div class="w-2/5">No. 项目名称</div>
            <div class="w-1/5 text-center">结果</div>
            <div class="w-1/5 text-center">参考值</div>
            <div class="w-1/5 text-right">单位</div>
          </div>
        </div>
      </div>
      <div class="flex">
        <div class="w-1/2 pr-5">
          <div v-for="(item, index) in printData?.printData?.lisRecordItemList" :key="index" class="flex justify-between items-center leading-7">
            <template v-if="index < 13 || index === 13">
              <div class="w-2/5">{{ index + 1 }}. {{ item.lisItemName }}</div>
              <div class="w-1/5 flex justify-center">
                <div class="mr-2">{{ item.lastResult }}</div>
                <div>
                  <div v-if="item.tips === '↓'" class="text-green-500">↓</div>
                  <div v-if="item.tips === '↑'" class="text-red-500">↑</div>
                </div>
              </div>
              <div class="w-1/5 text-center">{{ item.referValue }}</div>
              <div class="w-1/5 text-right">{{ item.unit }}</div>
            </template>
          </div>
        </div>
        <div class="w-1/2 pr-5">
          <div v-for="(item, index) in printData?.printData?.lisRecordItemList" :key="index" class="flex justify-between items-center leading-7">
            <template v-if="index > 13">
              <div class="w-2/5">{{ index + 1 }}. {{ item.lisItemName }}</div>
              <div class="w-1/5 flex justify-center">
                <div class="mr-2">{{ item.lastResult }}</div>
                <div>
                  <div v-if="item.tips === '↓'" class="text-green-500">↓</div>
                  <div v-if="item.tips === '↑'" class="text-red-500">↑</div>
                </div>
              </div>
              <div class="w-1/5 text-center">{{ item.referValue }}</div>
              <div class="w-1/5 text-right">{{ item.unit }}</div>
            </template>
          </div>
        </div>
      </div>
    </div>

    <div class="absolute bottom-1 left-2 w-full">
      <div class="border border-solid h-[20px] border-x-0 border-b-0 mt-20"></div>
      <div class="flex justify-between pr-20">
        <div>
          <div class="mb-2">送检医生：{{ printData.printData?.detail[0]?.sendDoctorName }}</div>
          <div>报告者：{{ printData.printData?.detail[0]?.reportName }}</div>
        </div>
        <div>
          <div class="mb-2">送检时间：{{ printData.printData?.detail[0]?.sendTime }}</div>
          <div>报告时间：{{ printData.printData?.detail[0]?.reportime }}</div>
        </div>
        <div>
          <!-- <div>接受者：{{ printData.printData?.detail[0]?.auditName }}</div> -->
          <div>审核人：{{ printData.printData?.detail[0]?.auditName }}</div>
        </div>
        <div>
          <!-- <div>接受时间：{{ printData.printData?.detail[0]?.auditTime }}</div> -->
          <div>审核时间：{{ printData.printData?.detail[0]?.auditTime }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { getSystemConfig } from '@/utils/systemConfig'

defineProps({
  printData: {
    type: Object,
    default: () => ({})
  }
})
</script>
<style lang="less" scoped></style>
